[models] Upgrade Qwen3.5 implementation to Qwen3.8, supports text-only path - #4355
Conversation
|
do we want to retire qwen 3.5 now or we can in addition support qwen 3.8 in the same folder? what are the major differences? |
My current plan is to retire all qwen3.5 and just keep Qwen 3.8 model. However qwen3.8 only have 27B model as the smallest model. Because the model architecture is the same, we can keep these small models in the config_regitry.py as well? |
I think we should keep two folders one for 3.5 and one for 3.8.
|
|
Updated per the follow-up: qwen3_5 is again the canonical shared implementation package (model, GatedDeltaNet, RoPE, vision encoder, sharding, parallelization, state-dict adapter, and existing tests/scripts). qwen3_8 is now lightweight and contains only its version-specific registry, recipes, and README while reusing the Qwen35 implementation names. The Qwen3.5 small dense and MoE flavors remain in their original registry. |
|
|
||
| self.vision_encoder = config.vision_encoder.build() | ||
| self.spatial_merge_size = config.vision_encoder.spatial_merge_size | ||
| self.vision_encoder = ( |
There was a problem hiding this comment.
Qwen3.8-2.4T-A95B model is text only so we want to allow None vision_encoder
tianyu-l
left a comment
There was a problem hiding this comment.
- need to be careful when you change model size in config_registry
- should we rename 3.5 to 3.6 if it also has all the small variants (don't if not)
| ) | ||
|
|
||
|
|
||
| def rl_grpo_qwen3_5_9b_varlen() -> Controller.Config: |
There was a problem hiding this comment.
shouldn't change this? model size change, then parallelism / ac settings may be invalidated
There was a problem hiding this comment.
Nice catch, let me create a separate 27B RL config and revert these
Qwen3.6 has the same structure as qwen3.5, but qwen3.5 has more size: 0.8B, 2B, 4B, 9B, 27B, 35B, 122B, 300B. Qwen3.6 only has 27B and 35B size, not smaller size model. Should we add another folder for Qwen3.6?
Update: I will just don't rename qwen3_5 to 3_6 as this moment, and don't add 3.6 model config (seems add little value there)
Summary
qwen3_5model package with a singleqwen3_8packagemodel.language_model.*for the multimodal checkpoint andmodel.*for the text-only checkpointqwen4_exparchitectureHugging Face retains the
Qwen3_5*implementation class and model-type names for these Qwen3.8 checkpoints, so those internal class names remain where they describe the upstream architecture contract.Qwen3.8-27B numerical parity
Tested against
Qwen/Qwen3.8-27Bwith Transformers 5.15 on an NVIDIA H100. The released 55.6 GB safetensor checkpoint was converted through the TorchTitan state-dict adapter to DCP without missing-key or shape errors.FP16 multimodal, three deterministic image-text samples
1.6405e-60.99997100%100%589824reconstructed pixel values matched, maximum difference1.19e-7Per-sample KL:
2.1510e-6,4.8427e-7,2.2861e-6.Text-only FP16 isolation
4.3627e-70.999966100%This isolates and validates the decoder architecture and HF weight conversion independently of the vision encoder.
BF16 multimodal, three deterministic samples
1.9280e-4100%Tests
uvx pre-commit run --all-filespytest -q tests/unit_tests/cpu/test_qwen3_8.py tests/unit_tests/cpu/test_no_new_cli_options.py::TestCliOptionsFrozen::test_every_model_is_guarded tests/unit_tests/cpu/components/data/test_qwen_multimodal_data.py::test_qwen38_recipe_geometry_matches_dataset_processor13 passedSome existing varlen-attention tests require the separately installed FlashAttention-3
flash_attn_interfacemodule.